﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;

namespace 李晓霞web
{
    public partial class Selectscore : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            string name;
            name = Session["UserName"].ToString();
            this.lblName.Text = name ;

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string strCn = "server=pc.hstc.cn;database=dhd2014112106;uid=2014112106;pwd=19950616";
            SqlConnection cn = new SqlConnection(strCn);
            try
            {
                cn.Open();
                string str姓名 = this.lblName.Text;
                string strSql = "SELECT   *   FROM      " + this.DropDownList4.Text + "   WHERE   (姓名 = '" + this.lblName.Text + "')";
               
                SqlCommand cmd = new SqlCommand(strSql, cn);
                SqlDataReader dr = cmd.ExecuteReader();
              
                this.GridView1.DataSource = dr;
                this.GridView1.DataBind();
                dr.Close();
            }
            catch (Exception ex)
            {
                this.lblInfo.Text = ex.Message;
            }
            finally
            {
                cn.Close();
            }
        }
    }
}